#include "test_list.h"


#ifdef TEST_WRAPPER_HELPER

//#include "disable_warning.h"
#include "tools/wrapper.h"

using namespace tools;

#include <vector>
#include <stack>
#include <map>

#define TEST_WRAPPER_HELPER_000
#define TEST_WRAPPER_HELPER_001
#define TEST_WRAPPER_HELPER_002
#define TEST_WRAPPER_HELPER_003
#define TEST_WRAPPER_HELPER_004
#define TEST_WRAPPER_HELPER_005
#define TEST_WRAPPER_HELPER_006
#define TEST_WRAPPER_HELPER_007
#define TEST_WRAPPER_HELPER_008

#define TEST_WRAPPER_HELPER_009
#define TEST_WRAPPER_HELPER_010
#define TEST_WRAPPER_HELPER_011
#define TEST_WRAPPER_HELPER_012
#define TEST_WRAPPER_HELPER_013
#define TEST_WRAPPER_HELPER_014
#define TEST_WRAPPER_HELPER_015
#define TEST_WRAPPER_HELPER_016
#define TEST_WRAPPER_HELPER_017

#define TEST_WRAPPER_HELPER_018
#define TEST_WRAPPER_HELPER_019
#define TEST_WRAPPER_HELPER_020
#define TEST_WRAPPER_HELPER_021
#define TEST_WRAPPER_HELPER_022
#define TEST_WRAPPER_HELPER_023
#define TEST_WRAPPER_HELPER_024

#define TEST_WRAPPER_HELPER_025
#define TEST_WRAPPER_HELPER_026
#define TEST_WRAPPER_HELPER_027
#define TEST_WRAPPER_HELPER_028
#define TEST_WRAPPER_HELPER_029
#define TEST_WRAPPER_HELPER_030
#define TEST_WRAPPER_HELPER_031
#define TEST_WRAPPER_HELPER_032

//------------------------------------------------------------------------------------------------------//
namespace{

struct IHelper: wrapper_detail::IHelper
{
    virtual bool IsPrimitive()const=0;
};
template<class U> struct Helper: wrapper_detail::HelperBase<U, Helper<U>, IHelper >
{
    static_assert( ! ::std::is_same<U, void>::value, "error: --- invalid void");

    Helper() { cout<<"helper<U>\n"; }
    virtual bool IsPrimitive()const{ return false; }
};

template<> struct Helper<bool>: wrapper_detail::HelperBase<bool, Helper<bool>, IHelper >
{
    Helper() { cout<<"helper<bool>\n"; }
    virtual bool IsPrimitive()const{ return true; }
};

//------------------------------------------------------------------------------------------------------//
template<class U> struct HelperData: wrapper_detail::HelperBase<U, HelperData<U>, IHelper >
{
    virtual bool IsPrimitive()const{ return false; }
    int ar[255];
};
template<> struct HelperData<char>: wrapper_detail::HelperBase<char, HelperData<char>, IHelper >
{
    virtual bool IsPrimitive()const{ return false; }
};
//------------------------------------------------------------------------------------------------------//
struct IHelperFailed
{
    virtual bool IsPrimitive()const=0;
};
template<class U> struct HelperFailed: wrapper_detail::HelperBase<U, HelperFailed<U>, IHelperFailed >
{
    virtual bool IsPrimitive()const{ return false; }
};
//------------------------------------------------------------------------------------------------------//


}//namespace
//------------------------------------------------------------------------------------------------------//

#ifdef TEST_WRAPPER_HELPER_000
TEST(Wrapper, helper_000)
{
    typedef tools::Wrapper<void, 32, Helper > Wrap;
    Wrap w(true);
    auto& helper = w.GetHelper();
    const bool primitive = helper.IsPrimitive();
    EXPECT_EQ(true, primitive );
    EXPECT_EQ(true, helper.IsInteger() );
}
#endif // TEST_WRAPPER_HELPER_000

#ifdef TEST_WRAPPER_HELPER_001
TEST(Wrapper, helper_001)
{
    typedef tools::Wrapper<void, 32, Helper > Wrap;
    Wrap w(10);
    auto& helper = w.GetHelper();
    const bool primitive = helper.IsPrimitive();
    EXPECT_EQ(false, primitive );
    EXPECT_EQ(true, helper.IsInteger() );
}
#endif // TEST_WRAPPER_HELPER_001

#ifdef TEST_WRAPPER_HELPER_002
TEST(Wrapper, helper_002)
{

//static assertion failed: ERROR: NOT ENOUGH SIZE FOR HELPER ON BUFER
//static_assert( eOFFSET >= sizeof(NewHelper), "ERROR: NOT ENOUGH SIZE FOR HELPER ON BUFER" );

//    typedef tools::Wrapper<void, 32, HelperData > Wrap;
//    Wrap w(10);
//    auto& helper = w.GetHelper();
//    const bool primitive = helper.IsPrimitive();
//    EXPECT_EQ(false, primitive );
//    EXPECT_EQ(true, helper.IsInteger() );
}
#endif // TEST_WRAPPER_HELPER_002

#ifdef TEST_WRAPPER_HELPER_003
TEST(Wrapper, helper_003)
{
//static assertion failed: ERROR: HELPER INTERFACE MUST BE INHERITED FROM THE IHelper

//    typedef tools::Wrapper<void, 32, HelperFailed > Wrap;
//    Wrap w(10);
//    auto& helper = w.GetHelper();
//    const bool primitive = helper.IsPrimitive();
//    EXPECT_EQ(false, primitive );
//    EXPECT_EQ(true, helper.IsInteger() );
}

#endif // TEST_WRAPPER_HELPER_003

#ifdef TEST_WRAPPER_HELPER_004
#endif // TEST_WRAPPER_HELPER_004

#ifdef TEST_WRAPPER_HELPER_005
#endif // TEST_WRAPPER_HELPER_005

#ifdef TEST_WRAPPER_HELPER_006
#endif // TEST_WRAPPER_HELPER_006

#ifdef TEST_WRAPPER_HELPER_007
#endif // TEST_WRAPPER_HELPER_007

#ifdef TEST_WRAPPER_HELPER_008
#endif // TEST_WRAPPER_HELPER_008

#ifdef TEST_WRAPPER_HELPER_009
#endif // TEST_WRAPPER_HELPER_009

#ifdef TEST_WRAPPER_HELPER_010
#endif // TEST_WRAPPER_HELPER_010

#ifdef TEST_WRAPPER_HELPER_011
#endif // TEST_WRAPPER_HELPER_011

#ifdef TEST_WRAPPER_HELPER_012
#endif // TEST_WRAPPER_HELPER_012

#ifdef TEST_WRAPPER_HELPER_013
#endif // TEST_WRAPPER_HELPER_013

#ifdef TEST_WRAPPER_HELPER_014
#endif // TEST_WRAPPER_HELPER_014

#ifdef TEST_WRAPPER_HELPER_015
#endif // TEST_WRAPPER_HELPER_015

#ifdef TEST_WRAPPER_HELPER_016
#endif // TEST_WRAPPER_HELPER_016

#ifdef TEST_WRAPPER_HELPER_017
#endif // TEST_WRAPPER_HELPER_017

#ifdef TEST_WRAPPER_HELPER_018
#endif // TEST_WRAPPER_HELPER_018

#ifdef TEST_WRAPPER_HELPER_019
#endif // TEST_WRAPPER_HELPER_019

#ifdef TEST_WRAPPER_HELPER_020
#endif // TEST_WRAPPER_HELPER_020

#ifdef TEST_WRAPPER_HELPER_021
#endif // TEST_WRAPPER_HELPER_021

#ifdef TEST_WRAPPER_HELPER_022
#endif // TEST_WRAPPER_HELPER_022

#ifdef TEST_WRAPPER_HELPER_023
#endif // TEST_WRAPPER_HELPER_023

#ifdef TEST_WRAPPER_HELPER_024
#endif // TEST_WRAPPER_HELPER_024

#ifdef TEST_WRAPPER_HELPER_025
#endif // TEST_WRAPPER_HELPER_025

#ifdef TEST_WRAPPER_HELPER_026
#endif // TEST_WRAPPER_HELPER_026

#ifdef TEST_WRAPPER_HELPER_027
#endif // TEST_WRAPPER_HELPER_027

#ifdef TEST_WRAPPER_HELPER_028
#endif // TEST_WRAPPER_HELPER_028

#ifdef TEST_WRAPPER_HELPER_029
#endif // TEST_WRAPPER_HELPER_029

#ifdef TEST_WRAPPER_HELPER_030
#endif // TEST_WRAPPER_HELPER_030

#ifdef TEST_WRAPPER_HELPER_031

#endif // TEST_WRAPPER_HELPER_031

#ifdef TEST_WRAPPER_HELPER_032
#endif // TEST_WRAPPER_HELPER_032



//#include "default_warning.h"


#endif
